﻿<UserControl x:Class="Microsoft.Research.Provenance.Controls.View.WorkflowOutputView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="Auto" Width="Auto" MaxHeight="300" AutomationProperties.Name="AIDWorkFlowOutputView">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../ProvenanceControlResources.xaml" ></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
            <BooleanToVisibilityConverter x:Key="boolToVisibilty"/>

            <!--Style for all TextBlock-->
            <Style TargetType="{x:Type TextBlock}" >
                <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Text }"/>
                <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
                <Setter Property="MaxHeight" Value="15" />
            </Style>
            <DataTemplate x:Key="ViewTextTemplate">
                <TextBlock Text="View" Cursor="Hand" TextDecorations="Underline" Foreground="Blue" PreviewMouseLeftButtonDown="OnLinkClick"/>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <Expander Expanded="OnExpanded"  Header="Workflow Outputs" Style="{DynamicResource ExpanderStyle2}" FontSize="12" Margin="10,10,10,10" IsExpanded="{Binding Path=IsExpanded}" AutomationProperties.Name="ANameANameWorkFlowOutputParametersExpander">
        <Border BorderBrush="#FFC8C8C8" BorderThickness="1,0,1,1" CornerRadius="0,0,5,5">
            <Border BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" Margin="5,5,5,5">
                <Grid>
                    <Border BorderBrush="Transparent" Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=DoesNotContainItems}">
                        <TextBlock Margin="5,5,5,5" Text="No worklfow output(s) available."/>
                    </Border>
                    <ListView VerticalAlignment="Stretch" 
                                  Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=ContainItems}"
                                  Height="230" IsSynchronizedWithCurrentItem="True" BorderBrush="#FFC8C8C8"
                                  Margin="0,0,0,0" ItemsSource="{Binding Path=OutputProperties}" 
                                  x:Name="listWorkflowOutputParameters"
                                  AutomationProperties.Name="ANameRequiredOutputListView">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Width="140" DisplayMemberBinding="{Binding Path=DisplayName}">
                                    <GridViewColumn.Header>
                                        <TextBlock Text="Parameter" FontWeight="Bold" AutomationProperties.Name="ANameOutputParameter"/>
                                    </GridViewColumn.Header>
                                </GridViewColumn>
                                <GridViewColumn Width="140" DisplayMemberBinding="{Binding Path=DataProductName}">
                                    <GridViewColumn.Header>
                                        <TextBlock Text="Dataproduct Name" FontWeight="Bold" AutomationProperties.Name="ANameDataproductName"/>
                                    </GridViewColumn.Header>
                                </GridViewColumn>
                                <GridViewColumn Width="100" CellTemplate="{StaticResource ViewTextTemplate}">
                                    <GridViewColumn.Header>
                                        <TextBlock Text="Value" FontWeight="Bold" AutomationProperties.Name="ANameDataproductValue"/>
                                    </GridViewColumn.Header>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                </Grid>
            </Border>
        </Border>
    </Expander>
</UserControl>
